// ActionScript file
// Event handler to initialize the MenuBar control.

	import jcrweb.as3.LoginUtil;
	
	import mx.controls.Alert;

	
	[Bindable]
    private var lanList:Array;
	private var loginUtil:LoginUtil;
	[Bindable]
	[Embed(source='../WebContent/images/error.gif')]
	private var iconError:Class;

	private function submit():void{
		if(this.username.text == ""){
			Alert.show("Please input username.","Error",0,null,null,iconError);
			return;
		}
		if(this.password.text == ""){
			Alert.show("Please input password.","Error",0,null,null,iconError);
			return;
		}
		loginUtil.login(this.username.text,this.password.text,this.language.selectedItem.name);
	}
	private function init():void {
		username.setFocus();
		username.drawFocus(false);
		loginUtil = new LoginUtil();
		lanList = new Array();
		lanList.push({name:"zh_CN",label:"中国语"});
		lanList.push({name:"en_US",label:"English"});
		lanList.push({name:"ja_JP",label:"日本語"});
		
		this.language.selectedIndex=0;
	}
	private function reset():void{
		this.username.text="";
		this.password.text="";
	}
	
